package com.cci.kangdao.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import com.cci.kangdao.dao.model.CompanyT;
import com.cci.kangdao.dao.model.CourseTrainingT;
import com.cci.kangdao.dao.model.EngineTypeT;
import com.cci.kangdao.dao.model.SMNT;
import com.cci.kangdao.dao.model.ServiceToolT;
import com.cci.kangdao.dao.model.WorkOrderT;

/**
 * 发动机型号类dao
 *
 */
@MapperScan
public interface EngineTypeTDao {
	
	/**
	 * 根据发动机主键id获取发动机型号名称
	 * @param type
	 * @return
	 */
	@Select("select * from EngineType_T where ID = #{EngineTypeTId} and Flag=0")
	public EngineTypeT getEngineTypeNameById(Map<String, Object> map);

	//获取支持机型清单   2.4.0把cds支持清单整合到smn_T表
	@Select("select a.SMNname as SMN,b.CompanyNo as JV,a.EmissionStandard as standard from SMN_T a\n" +
			"inner join Company_T b on a.Manufacturer = b.ID\n" +
			"where a.Flag = 0 and b.Flag = 0 and a.IsSupportCDS = 1")
	public List<Map<String,Object>> getSupportEngineTypeTList();

	/**
	 * 根据机型名称获取机型信息
	 * @param typeName
	 * @return 机型信息
	 */
	@Select("select * from EngineType_T where TypeName = #{typeName} and Flag=0")
	EngineTypeT getEngineTypeByTypeName(String typeName);
	
	List<String> selectEngineTypeNameByIds(@Param("list")List<Long> ids);


	public int insert(Map<String , Object> map);

	/**
	 * 验证数据是否存在
	 * @param map
	 * @return
	 */
	@Select("SELECT top 1 * FROM EngineType_T\n" +
			"WHERE flag=0 and TypeName = #{typename} and EnginTypeSys=#{engintypesys}")
	public Map<String,Object> verify(Map<String, Object> map);


	public int updateByPrimaryKey(Map<String , Object> map);
}
